import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:sqflite_demo/page/home_page.dart';
import 'package:sqflite_demo/provider/book_provider.dart';
import 'package:sqflite_demo/router/MyRouter.dart';




Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => BookProvider()),
      ],
      child: Consumer<BookProvider>(
        builder: (context, bookProvider, child) {
          return MaterialApp(

              theme: ThemeData(
                colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
              ),

            // 使用这种方式可以指定路由切换的动画过度效果
            onGenerateRoute: MyRouter.onGenerateRoute,
            home: HomePage(),
          );
        },
      )
    );
  }
}
